package com.patrol.logisticsmanage.ui.canteen.fragments;


import android.os.Bundle;

import com.patrol.logisticsmanage.R;
import com.patrol.logisticsmanage.ui.base.LazyFragment;
import com.patrol.logisticsmanage.ui.canteen.Views.AddWidget;
import com.patrol.logisticsmanage.ui.canteen.Views.ListContainer;
import com.patrol.logisticsmanage.ui.canteen.adapters.FoodAdapter;
import com.patrol.logisticsmanage.ui.canteen.adapters.TypeAdapter;
import com.patrol.logisticsmanage.ui.canteen.bean.RequestFoodListBean;
import com.patrol.logisticsmanage.ui.canteen.utils.LogUtils;

import java.util.List;


public class FirstFragment extends LazyFragment {

	private ListContainer listContainer;
	boolean isCanOrder = false;

	public void setCanOrder(boolean canOrder) {
		isCanOrder = canOrder;
	}

	@Override
	protected void onCreateViewLazy(Bundle savedInstanceState) {
		super.onCreateViewLazy(savedInstanceState);
		setContentView(R.layout.fragment_first);
		listContainer = (ListContainer) findViewById(R.id.listcontainer);
		listContainer.setAddClick((AddWidget.OnAddClick) getActivity());
		listContainer.foodAdapter.setCanOrder(isCanOrder);
	}

	public void setData(List<RequestFoodListBean> requestFoodListBeans){
		listContainer.setListData(requestFoodListBeans);
	}

	public FoodAdapter getFoodAdapter() {
		return listContainer.foodAdapter;
	}

	public TypeAdapter getTypeAdapter() {
		return listContainer.typeAdapter;
	}

	@Override
	public void onDetach() {
		super.onDetach();
		LogUtils.e("________________"+getParentFragmentManager());
	}
}
